" Default configuration file for Vim
" Written by Aron Griffis <agriffis@gentoo.org>
" Modified by Ryan Phillips <rphillips@gentoo.org>
" Added Redhat's vimrc info by Seemant Kulleen <seemant@gentoo.org>

" The following are some sensible defaults for Vim for most users.
" We attempt to change as little as possible from Vim's defaults,
" deviating only where it makes sense
set nocompatible        " Use Vim defaults (much better!)
set bs=2                " Allow backspacing over everything in insert mode
set ai                  " Always set auto-indenting on
"set backup             " Keep a backup file
set viminfo='20,\"500   " read/write a .viminfo file -- limit regs to 500 lines
set history=50          " keep 50 lines of command history
set ruler               " Show the cursor position all the time

set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif 

" Added to default to high security within Gentoo. Fixes bug #14088.
" Modified 07 Oct 2003 by agriffis from "modelines=0" to "nomodeline"
" according to conversation on vim devel ML:
" http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=212696
" http://article.gmane.org/gmane.editors.vim.devel/4410
set nomodeline

if v:lang =~ "^ko"
  set fileencodings=euc-kr
  set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
elseif v:lang =~ "^ja_JP"
  set fileencodings=euc-jp
  set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
elseif v:lang =~ "^zh_TW"
  set fileencodings=big5
  set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
elseif v:lang =~ "^zh_CN"
  set fileencodings=gb2312
  set guifontset=*-r-*
endif
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
  set fileencodings=utf-8,latin1
endif

" Don't use Ex mode, use Q for formatting
map Q gq
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

if &term=="xterm"
  set t_RV=          " don't check terminal version
  set t_Co=8
  set t_Sb=^[4%dm
  set t_Sf=^[3%dm
endif
set ts=4 sw=4 sts=4
set wmh=0

map ;. :setlocal nospell<CR>
map ;, :setlocal spell spelllang=en_us<CR>
map ;/ z=
map ;> ]s
map ;< [s
map ;N n.

map ;n :set number!<CR>
map ;p :set paste!<CR>
map ;i :set autoindent<CR>

map ;m :!~/.vim/mysql.sh<CR>
map ;a :!~/.vim/apache.sh<CR>
map ;l :!~/.vim/logs.sh<CR>
map ;L :exe ":!~/.vim/logs.sh \| grep " . expand("<cword>") <CR>
map ;va :exe ":!svn add " . getreg("%") . "" <CR>

map ;vS :exe ":!svn stat " . expand("%:p:h") . " \| less " <CR>
map ;VS :exe ":!svn stat `cat ~/.curr_apache_proc.txt` \| less " <CR>

map ;vd :exe ":!svn diff " . getreg("%") . " \| less " <CR>
map ;vD :exe ":!svn diff " . expand("%:p:h") . " \| less " <CR>
map ;VD :exe ":!svn diff `cat ~/.curr_apache_proc.txt` \| less " <CR>

map ;gm :exe ":!(cd `cat ~/.curr_apache_proc.txt`/Model; python genModel.py)" <CR>

map ;s :!~/.vim/shell.sh<CR>
map ;e :w<CR>:exe ":!perl " . getreg("%") . "" <CR>
map ;E :w<CR>:exe ":!perl -I`cat ~/.curr_apache_proc.txt`/cgi-lib " . getreg("%") . "" <CR>

map ;o :Sex <CR>
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-l> <C-W>l
map <C-h> <C-W>h
map ;] :tabnext<CR>
map ;[ :tabprev<CR>
map <C-t> :tabe +"browse ."<CR>
map <C-O> :NERDTreeToggle ~/curr/trunk/<CR>


:abbr TRANS $TRANS->get('FIND_ME_TOKEN',$m)<Esc>/FIND_ME_TOKEN<CR>cw
:abbr INIT <%init><CR>FIND_ME_TOKEN<CR></%init><Esc>/FIND_ME_TOKEN<CR>cw
:abbr PERL <%perl><CR>FIND_ME_TOKEN<CR></%perl><Esc>/FIND_ME_TOKEN<CR>cw
:abbr DOC <%doc><CR>FIND_ME_TOKEN<CR></%doc><Esc>/FIND_ME_TOKEN<CR>cw
:abbr METHOD <%methodFIND_ME_TOKEN><CR></%method><Esc>/FIND_ME_TOKEN<CR>cw
:abbr DEF <%defFIND_ME_TOKEN><CR></%def><Esc>/FIND_ME_TOKEN<CR>cw
:abbr ARGSS <%args><CR>FIND_ME_TOKEN<CR></%args><Esc>/FIND_ME_TOKEN<CR>cw
:abbr <> <%FIND_ME_TOKEN %><Esc>/FIND_ME_TOKEN<CR>cw
:abbr SESS_INPUT <input type="hidden" name="session_id" value="<% $m->session->{_session_id} %>">
:abbr HIDDEN <input type="hidden" name="FIND_ME_TOKEN" value="FIND_ME_TOKEN"><Esc>/FIND_ME_TOKEN<CR>cw
:abbr IP_LINE my $ip = session_scope($m);

:abbr INPUT_OTHER cat /Users/exegete/svn/exe-vim-setup/vim_abbr/INPUT_OTHER.txt<Esc>!!sh<CR>/DELETE_ME<CR>
:abbr INPUT_CONT cat /Users/exegete/svn/exe-vim-setup/vim_abbr/INPUT_CONT.txt<Esc>!!sh<CR>/DELETE_ME<CR>
:abbr INPUT_TEXT cat /Users/exegete/svn/exe-vim-setup/vim_abbr/INPUT_TEXT.txt<Esc>!!sh<CR>/DELETE_ME<CR>
:abbr FLAGS cat /Users/exegete/svn/exe-vim-setup/vim_abbr/FLAGS.txt<Esc>!!sh<CR>
:abbr SHARED cat /Users/exegete/svn/exe-vim-setup/vim_abbr/SHARED.txt<Esc>!!sh<CR>
:abbr TEMPL_METHOD cat /Users/exegete/svn/exe-vim-setup/vim_abbr/TEMPL_METHODS.txt<Esc>!!sh<CR>
:abbr INPUT_DROP cat /Users/exegete/svn/exe-vim-setup/vim_abbr/INPUT_DROP.txt<Esc>!!sh<CR>/DELETE_ME<CR>
:abbr AJAX_HOOKS cat /Users/exegete/svn/exe-vim-setup/vim_abbr/AJAX_HOOKS.txt<Esc>!!sh<CR>/DELETE_ME<CR>
:abbr YES_NO cat /Users/exegete/svn/exe-vim-setup/vim_abbr/YES_NO.txt<Esc>!!sh<CR>

let NERDTreeIgnore=['\.pyc$']

augroup BEGIN
   au BufRead,BufNewFile svn-commit*tmp :1
   au BufRead,BufNewFile svn-commit*tmp :r /home/exegete/.vim_abbr/svn-commit.txt
   au BufRead,BufNewFile svn-commit*tmp :1
   au BufRead,BufNewFile svn-commit*tmp :delete
   au BufRead,BufNewFile svn-commit*tmp :1
   au BufRead,BufNewFile svn-commit*tmp :start!
augroup END
augroup BEGIN
   au BufRead,BufNewFile hg-editor-*.txt :1
   au BufRead,BufNewFile hg-editor-*.txt :r /home/exegete/.vim_abbr/svn-commit.txt
   au BufRead,BufNewFile hg-editor-*.txt :1
   au BufRead,BufNewFile hg-editor-*.txt :delete
   au BufRead,BufNewFile hg-editor-*.txt :1
   au BufRead,BufNewFile hg-editor-*.txt :start!
augroup END
